home *** CD-ROM | disk | FTP | other *** search
- /* (C) Copyright 1991 Dave Fritsche (wb8zxu), All Rights Reserved.
- *
- * Redistribution and use in source and binary forms are permitted for
- * non-commercial use, provided that the above copyright notice and this
- * paragraph are duplicated in all such forms. THIS SOFTWARE IS PROVIDED
- * ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
- * WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE.
- */
- #include <stdio.h>
- #include <dir.h>
- #include "screen.h"
-
- mk_ftpu(fnm)
- unsigned char fnm[];
- {
- FILE *ftpu;
- unsigned char buf[128], drive[MAXDRIVE], dir[MAXDIR], fname[MAXFILE];
- unsigned char ext[MAXEXT], tmp_path[128], tmp[10];
- int n, m;
-
- strcpy(tmp_path, path);
- m = strlen(tmp_path);
- for (n = 0; n < m; n++)
- if (tmp_path[n] == '\\')
- tmp_path[n] = '/';
- n = fnsplit(tmp_path, drive, dir, fname, ext);
-
- sprintf(buf, "%s\\%s", path, fnm);
- if (debug)
- {
- printf("***> ftpusers file (%s):\n", buf);
- ftpu = stdout;
- }
- else
- {
- if ( (ftpu = fopen(buf, "r")) != NULL )
- {
- printf("\n(%s) already exists, overwrite (y/n)? ",buf);
- scanf("%s", tmp);
- if ( (tmp[0] != 'y') && (tmp[0] != 'Y') )
- {
- fclose(ftpu);
- return 0;
- }
- }
- fclose(ftpu);
- if ( (ftpu = fopen(buf, "w")) == NULL )
- {
- printf("\nCan't open \"%s\" for write, aborting!\n\n", buf);
- exit(-1);
- }
- }
-
- fprintf(ftpu, "# ============================================================\n");
- fprintf(ftpu, "# PUBLIC/EXTERNAL ACCOUNTS\n");
- fprintf(ftpu, "# ============================================================\n");
- fprintf(ftpu, "# 1 = File read permission\n");
- fprintf(ftpu, "# 2 = Non-destructive file write permission\n");
- fprintf(ftpu, "# 4 = Delete and destructive file write permission\n");
- fprintf(ftpu, "# 8 = Mbox AX.25 gateway permission\n");
- fprintf(ftpu, "# 16 = Mbox telnet permission\n");
- fprintf(ftpu, "# 32 = Mbox Netrom permission\n");
- fprintf(ftpu, "# 64 = Mbox Remote control permission\n");
- fprintf(ftpu, "# 128 = Disallow this user access\n");
- fprintf(ftpu, "#\n");
- fprintf(ftpu, "anonymous * %s%s/pub 59\n", dir, fname);
- fprintf(ftpu, "bbs * %s%s/pub 59\n", dir, fname);
- fprintf(ftpu, "%s * %s%s/pub 59\n", callsign, dir, fname);
-
- if (!debug)
- fclose(ftpu);
- }
-